#ifndef SIGNLANGUAGE_H
#define SIGNLANGUAGE_H

//Generic Imports
#include <QtGui/QMainWindow>
#include <iostream>
#include "ui_MainGUI.h"
#include "VideoContainer.h"
#include "searchwindow.h"
#include <QMessageBox>
#include <QShortcut>

//Camera and Video specific includes
#include <QWidget>
#include <QVBoxLayout>
#include "WebcamVideoPlayer.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <Phonon/VideoWidget>
#include <Phonon/MediaObject>
#include <QDir>
#include <QPixmap>
#include <QTimer>

class SignLanguage : public QMainWindow
{
    Q_OBJECT
private:

    /* Declarations of variables
     * Variables declarations are split into areas for readability
     * and logicalness.
     */

    //Generic variable
    Ui_MainWindow* ui;

    //Webcam variables
    WebcamVideoPlayer *webcam;
    CvCapture *camera;
    bool playingWebcam;    
    int hSize;    
    bool webcamTabOpen; //tracks whether the video tab is open or closed
    bool hasCamera; //whether a web cam is available

    //Search window
    Ui_SearchWindow uis;
    SearchWindow searchEngine;
    QShortcut* search_shortcut;

    //Video player
    QString image_filename;
    QString video_filename;
    QString dir;
    Phonon::MediaObject *clip;
    int frameRateOffseter;
    bool playingStoredClip;
    bool paused;

    //video recording
    int frameCounter;
    bool recording;
    bool playRecording;
    bool flashRecordingSquare;
    VideoContainer vidRec;

    //the all powerfull, all mighty QTimer (without which all program life would end)
    QTimer *timer;

public:
    //See the .cpp file for detailed method comments
    SignLanguage(QWidget *parent = 0);
    void startConnections(Ui_MainWindow* UI);
    ~SignLanguage();

public slots:
    //slots that are attached to events.
    void tabChanged();
    void play1();
    void play2();
    void stop1();
    void stop2();
    void record();
    void playBoth();
    void deleteClicked();
    void search();
    void okClicked();
    void videoFinished();
    void updateInterval();

};

#endif // SIGNLANGUAGE_H
